package com.stone.business.plan.action;

/**
 * <pre>
 * ----计划列表 Action---
 * </pre>
 */

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import net.sf.json.JSON;
import net.sf.json.JSONSerializer;
import net.sf.json.JsonConfig;

import com.stone.para.IConstant;
import com.stone.utils.JsonUtils;
import com.stone.utils.StringUtils;

import frm.ssh.action.BaseListAction;
import frm.ssh.exception.AppException;
import frm.ssh.util.SpringUtil;
import frm.ssh.util.page.CustomPage;

import com.stone.business.plan.pojo.TPlan;
import com.stone.business.plan.service.PlanService;

public class PlanListNextAction extends BaseListAction {

	private PlanService planService;
	
	public PlanService getPlanService() {
		return planService;
	}

	public void setPlanService(PlanService planService) {
		this.planService = planService;
		this.service=planService;
	}
	
	/** * 构造方法. */
    public PlanListNextAction() {
        this.entityClass = TPlan.class;
    }
	
	/**
	 * 设置查询条件
	 */
	public HashMap<String, Object> setSearchCondition() {
		
		HashMap<String, Object> m = new HashMap<String, Object>();
		List<Object> valsList = new ArrayList<Object>();
		String organCode = String.valueOf(super.getSession().getAttribute(IConstant.SESSION_TORGAN_CODE));
		m.put("cols", "plan");
		
		String conditions = " 1=1 ";
		 
		//----------------------查询条件---------------------
		if (!StringUtils.isNullOrBlankFull(super.getSearchBean().getCon1())){
			conditions += " AND u.startdate like ? ";
			valsList.add("%" + super.getSearchBean().getCon1()+ "%");
		}
		// 变电站名称
		if (!StringUtils.isNullOrBlankFull(super.getSearchBean().getCon2())){
			conditions += " AND u.enddate like ? ";
			valsList.add("%" + super.getSearchBean().getCon2()+ "%");
		}
		// 计划类型
		if (!StringUtils.isNullOrBlankFull(super.getSearchBean().getCon3())){
			conditions += " AND u.teamnames like ? ";
			valsList.add("%" + super.getSearchBean().getCon3()+ "%");
		}
		
		if (!StringUtils.isNullOrBlankFull(super.getSearchBean().getCon4())){
			conditions += " AND u.stationname like ? ";
			valsList.add("%" + super.getSearchBean().getCon4()+ "%");
		}
		// con8 标识 1保存  2已经  3审核通过 0全部
   		//state 项目状态  1保存 2已提交 3 审核通过 
		
		if(!StringUtils.isNullOrBlank(super.getSearchBean().getCon8())){
		 conditions += " AND status = ?";
		 valsList.add(super.getSearchBean().getCon8());
		}
	
		m.put("conditions",conditions);
		m.put("clause"," order by plan.id desc");
		m.put("alias", "plan");
		m.put("vals", valsList.toArray());
		return m;
		
	}


	
	
}
